Skip to main content

常用 exec 语句

-- show databases;
-- use myblog;

-- show tables;

-- insert into users(username,`password`,realname) values('lisi','123','李四');

-- select * from users;
-- select id,username from users;
-- select * from users where username='zhangsan' and `password`='123';
-- select * from users where username like '%zhang%';
-- select * from users where password like '%1%' order by id;
-- select * from users where password like '%1%' order by id desc;

-- SET SQL_SAFE_UPDATES = 0;

-- update users set realname='李四2' where username='lisi'

-- 真删除
-- delete from users where username='lisi';

-- 软删除
-- select * from users where state = '1';
-- select * from users where state <> '0';-- 不等于1
-- update users set state='0' where username='lisi';

-- insert into blogs (title,content,createtime,author) values ('标题B','内容B',1657533036265,'lisi');
-- select * from blogs where title like '%标题%' order by createtime desc;

-- ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

-- 需要更改password的限度
-- update users set password='a75de9c22884f227137abd0ad9c6c0a6' where username='zhangsan';
-- select * from users;